Line2: increase test coverage - #807
Conversation
1. Set with Vector2 parameters: Verified setting start/end points
using Vector2 instances.
2. CrossProduct: Added explicit tests for both Line2 and Vector2
cross products. Expect CrossProduct of parallel lines is 0.
3. OnSegment and Within: Tested points on segment, collinear points
outside bounds, non-collinear points within bounding box, and endpoints.
4. Intersect Branch Coverage:
• Parallel collinear non-overlapping line segments.
• Collinear lines where only the second endpoint lies on the segment.
• Line extensions that intersect outside X or Y bounding ranges.
• Intersect overload taking no output point.
5. Operators: Expanded operator== and operator!= self-comparison checks.
6. Template Types: Added test cases for Line2i (int) and Line2f (float).
Assisted-by: Gemini 3.6 Flash
Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
* Set: use static_cast<T> * Length: use simpler approach from Line3::Length along with static_cast<T> Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
84266d7 to
2a719e4
Compare
|
https://github.com/Mergifyio backport gz-math9 gz-math8 gz-math7 ign-math6 |
✅ Backports have been createdDetails
Cherry-pick of 268039c has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
Cherry-pick of 268039c has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally
Cherry-pick of 268039c has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
1. Set with Vector2 parameters: Verified setting start/end points
using Vector2 instances.
2. CrossProduct: Added explicit tests for both Line2 and Vector2
cross products. Expect CrossProduct of parallel lines is 0.
3. OnSegment and Within: Tested points on segment, collinear points
outside bounds, non-collinear points within bounding box, and endpoints.
4. Intersect Branch Coverage:
• Parallel collinear non-overlapping line segments.
• Collinear lines where only the second endpoint lies on the segment.
• Line extensions that intersect outside X or Y bounding ranges.
• Intersect overload taking no output point.
5. Operators: Expanded operator== and operator!= self-comparison checks.
6. Template Types: Added test cases for Line2i (int) and Line2f (float).
Assisted-by: Gemini 3.6 Flash
Fix type conversion warnings
* Set: use static_cast<T>
* Length: use simpler approach from Line3::Length
along with static_cast<T>
(cherry picked from commit 268039c)
Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
Co-authored-by: Steve Peters <scpeters@intrinsic.ai>
Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Carlos Agüero <caguero@honurobotics.com>
Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Carlos Agüero <caguero@honurobotics.com>
Assisted-by: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Carlos Agüero <caguero@honurobotics.com>
🦟 Bug fix
Improve test coverage of Line2 class
Summary
This increases test coverage based on suggestions from Gemini. After observing some windows C4244 compiler warnings, I fixed them in 2a719e4:
Set(double, double, double, double)by wrapping withstatic_cast<T>Length()by using the simpler implementation fromLine3.hhwrapped withstatic_cast<T>:gz-math/include/gz/math/Line3.hh
Lines 135 to 138 in 396f5a5
Summary of test coverage improvements
Backport Policy
Checklist
codecheckpassed (See contributing)Assisted-by: Gemini 3.6 Flash
Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-byandGenerated-bymessages.Backports: If this is a backport, please use Rebase and Merge instead.